package com.atguigu.blog.user.retryers;

import feign.RetryableException;
import feign.Retryer;

public class MyRetryer implements Retryer {
    private int start = 1;
    private int end = 3;

    @Override
    public void continueOrPropagate(RetryableException e) {
        System.out.println("第" + start + "次重试");
        if (start >= end) {
                throw  new RuntimeException(e);
        }
        start++;
    }

    @Override
    public Retryer clone() {
        return new MyRetryer();
    }
}
